#ifndef __IMAGE_H__
#define __IMAGE_H__

#include "ui/uiobject.h"
#include "graphics/bitmap.h"
#include "imagedecoder/decoder.h"

namespace MiniUI
{

class Image : public UIObject,
              public Creator<Image>,
			  public TypeObject<Image>
{
public:
    friend class Creator<Image>;
protected:
    Image();
    virtual ~Image();
public:
    bool RenderTo(Graphics& graphics, const Type::MiniRect& rcRender, const uint8 blendValue);
    bool SetValue(const char* szImagePath);
    const char* GetValue();
    // operate to bitmap directly.
    void SetBitmap(Bitmap* pBitmap);
    Bitmap* GetBitmap();
private:
    bool LoadBitmap(const char* szImagePath);
    void CheckAlpha(DecodeFormat* deco);
private:
    std::string m_strImagePath;
    Bitmap* m_pBitmap;
};

}

#endif